<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$menu  = $_POST['mID'];
$tagname = $_POST['newtag'];

if (($tagname != '') AND ($menu != 0)){
    


include '../../../../readcookie.php';
include '../../../../db.php';

//TODO: improve 9999

$query = "INSERT INTO Tag (tagNAME) VALUES ('$tagname')";
mysql_query($query) or die('Error, insert query failed');
$lasti =  mysql_insert_id();
$linkage = "INSERT INTO TagMenu (tmMENUID,tmTAGID) VALUES ('$menu','$lasti')";
mysql_query($linkage) or die('Error, insert query failed');

}
echo '
<script type="text/javascript">
window.location.href = document.referrer;
</script>
';
?>

